package com.simple.simple_view.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.simple.simple_view.domain.ResponseResult;
import com.simple.simple_view.domain.dto.FavoriteDto;
import com.simple.simple_view.domain.entity.UserLikeVideo;
import com.simple.simple_view.domain.system.RabbitMQConstant;
import com.simple.simple_view.mapper.UserLikeVideoMapper;
import com.simple.simple_view.service.HotVideoService;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Service;
import com.simple.simple_view.service.UserLikeVideoService;

import javax.annotation.Resource;

/**
 * 用户点赞表(UserLikeVideo)表服务实现类
 *
 * @author makejava
 * @since 2023-10-31 02:26:29
 */
@Service("userLikeVideoService")
public class UserLikeVideoServiceImpl extends ServiceImpl<UserLikeVideoMapper, UserLikeVideo> implements UserLikeVideoService {

    @Resource
    RabbitTemplate rabbitTemplate;
    @Resource
    HotVideoService hotVideoService;
    @Override
    public ResponseResult like(FavoriteDto favoriteDto) {
        //发送点赞事件
        rabbitTemplate.convertAndSend(RabbitMQConstant.EXCHANGE_TOPIC,RabbitMQConstant.KEY_VIDEO,favoriteDto);
        return ResponseResult.okResult();
    }
}
